using System;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.IO;
using System.Text;
using System.Drawing;

namespace GifTool
{
    class Program
    {
        static void Main(string[] args)
        {
            FileInfo fi = new FileInfo(args[0]);
            Image image = Image.FromFile(fi.FullName);
            FrameDimension frameDim = new FrameDimension(image.FrameDimensionsList[0]);
            int frameCount = image.GetFrameCount(frameDim);
            for (int i = 0; i < frameCount; i++)
            {
                image.SelectActiveFrame(frameDim, i);
                Bitmap newImage = new Bitmap(image);
                Graphics g = Graphics.FromImage(newImage);
                g.DrawImage(image, 0, 0, image.Width, image.Height);

                newImage.Save(fi.Directory.FullName + "\\" + fi.Name.Split('.')[0] + i.ToString("0#") + fi.Extension);
            }
        }
    }
}
